package com.briup.server.domain.dto;

import com.briup.common.constraints.Add;
import com.briup.common.constraints.Update;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

/**
 * 菜单修改获取新增参数实体
 */
@Data
public class MenuDTO {
    @Null(groups = Add.class, message = "新增时ID字段必须为空")
    @NotNull(groups = Update.class, message = "更新时ID字段不能为空")
    private Long id;
    /**
     * 父菜单ID，一级菜单为0
     */
    @NotNull(message = "父菜单ID字段不能为空")
    @Min(value = 0, message = "父菜单ID字段必须大于等于0")
    private Long parentId;
    /**
     * 菜单名称
     */
    @NotBlank(message = "菜单名称不能为空")
    private String name;
    /**
     * 菜单对应的URL地址，用于前端路由跳转
     */
    private String path;
    /**
     * 菜单对应的组件路径，用于前端渲染
     */
    private String component;
    /**
     * 菜单权限字符串，用于权限校验
     */
    private String perms;
    /**
     * 类型   0：目录   1：菜单   2：按钮
     */
    @NotNull(message = "类型字段不能为空")
    @Range(min = 0, max = 2, message = "类型字段必须在0-2之间")
    private Integer type;
    private String icon;
    @NotNull(message = "排序字段不能为空")
    @Min(value = 0, message = "排序字段必须大于等于0")
    private Integer orderNum;
}
